//
//  MSDetaileEvaluationCell.m
//  觅尚
//
//  Created by No.8 on 2019/4/3.
//  Copyright © 2019 No.8. All rights reserved.
//

#import "MSDetaileEvaluationCell.h"
#import "MSDetailedEvaluationController.h"

@implementation MSDetaileEvaluationCell

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    MSDetaileEvaluationCell * cell = [tableView dequeueReusableCellWithIdentifier:[MSDetaileEvaluationCell ID]];
    cell = [[MSDetaileEvaluationCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[MSDetaileEvaluationCell ID]];
    cell.backgroundColor = backgroundcolor;
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setMember];
        
    }
    return self;
}
- (void)setMember{
    /** 时间*/
    self.TimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 40 * px, ScreenWidth / 4, 60 * px)];
    self.TimeLabel.textColor = [UIColor whiteColor];
    self.TimeLabel.text = @"2019.03.22";
    self.TimeLabel.textAlignment = NSTextAlignmentCenter;
    self.TimeLabel.font = [UIFont systemFontOfSize:SYRealValue(28 / 2)];
    [self addSubview:self.TimeLabel];
    
    
    /** 头像*/
    self.PhotoIMG = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenWidth / 4 + ScreenWidth / 4 / 5, self.TimeLabel.y, 60 * px, self.TimeLabel.height)];
    self.PhotoIMG.backgroundColor = [UIColor redColor];
    self.PhotoIMG.layer.cornerRadius = 30 * px;
    self.PhotoIMG.layer.masksToBounds = YES;
    [self addSubview:self.PhotoIMG];
    
    
    /** 昵称*/
    self.NameLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.PhotoIMG.frame) + 10 * px, self.TimeLabel.y, self.TimeLabel.width, self.TimeLabel.height)];
    self.NameLabel.textColor = self.TimeLabel.textColor;
    self.NameLabel.text = @"刘强";
    self.NameLabel.textAlignment = NSTextAlignmentLeft;
    self.NameLabel.font = self.TimeLabel.font;
    [self addSubview:self.NameLabel];
    
    
    /** 金额*/
    self.MoneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenWidth * 0.5, self.TimeLabel.y, self.TimeLabel.width, self.TimeLabel.height)];
    self.MoneyLabel.textColor = self.TimeLabel.textColor;
    self.MoneyLabel.text = @"￥2000";
    self.MoneyLabel.textAlignment = NSTextAlignmentCenter;
    self.MoneyLabel.font = self.TimeLabel.font;
    [self addSubview:self.MoneyLabel];
    
    
    /** 收益*/
    self.ProfitLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenWidth / 4 * 3, self.TimeLabel.y, self.TimeLabel.width, self.TimeLabel.height)];
    self.ProfitLabel.textColor = WYCRGBColor(82, 183, 166);
    self.ProfitLabel.text = @"￥2000";
    self.ProfitLabel.textAlignment = NSTextAlignmentCenter;
    self.ProfitLabel.font = self.TimeLabel.font;
    [self addSubview:self.ProfitLabel];
    
    self.LinView = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.TimeLabel.frame) + 40 * px, ScreenWidth, 1)];
    self.LinView.backgroundColor = BackViewColor;
    [self addSubview:self.LinView];
    
}

- (void)setDetailedEvaluationModel:(MSDetailedEvaluationModel *)DetailedEvaluationModel{
    _DetailedEvaluationModel = DetailedEvaluationModel;
    self.TimeLabel.text = [NSString stringWithFormat:@"%@",DetailedEvaluationModel.queryTime];
    
    self.NameLabel.text = [NSString stringWithFormat:@"%@",DetailedEvaluationModel.userName];
    
    [self.PhotoIMG sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",DetailedEvaluationModel.avatarUrl]]];
    
    self.MoneyLabel.text = [NSString stringWithFormat:@"￥%@",DetailedEvaluationModel.money];
    
    self.ProfitLabel.text = [NSString stringWithFormat:@"￥%@",DetailedEvaluationModel.rewardMoney];
}
+(NSString *)ID{
    return @"cell";
}

@end
